#include "tools.h"

class Solution {
public:
    bool helper(string& q, string& p){
        int i = q.size() - 1, j = p.size() - 1;
        while(i > -1 && j > -1){
            if(q[i] != p[j]){
                if(isupper(q[i])) return false;
                --i;
            }else{
                --i;
                --j;
            }
        }
        cout << i << " " << j << endl;
        if(i == -1 && j == -1) return true;
        if(i == -1) return false;
        while(i > -1)
            if(isupper(q[i--])) return false;
        return true;
    }
    vector<bool> camelMatch(vector<string>& queries, string pattern) {
        vector<bool> res;
        for(string& q: queries){
            bool b = helper(q, pattern);
            res.emplace_back(b);
        }
        return res;
    }
};



int main(int argc, char const *argv[])
{
    vector<string> queries = {"aksvbjLiknuTzqon","ksvjLimflkpnTzqn","mmkasvjLiknTxzqn","ksvjLiurknTzzqbn","ksvsjLctikgnTzqn","knzsvzjLiknTszqn"};//};//"FooBar","FooBarTest","FootBall","FrameBuffer",
    string pattern = "ksvjLiknTzqn";
    Solution s;
    vector<bool> res = s.camelMatch(queries, pattern);
    show(res);
    
    return 0;
}
